package com.meichis.yndms.vm;

import androidx.lifecycle.MutableLiveData;

import com.meichis.yndms.model.AppVersion;
import com.meichis.yndms.repository.manager.AppUpdataManager;

/**
 * @author xmy
 * @title
 * @remake
 * @create 2021-05-08 15:26
 */
public class AppUpdateVM extends MyViewModel {
    private MutableLiveData<AppVersion> appVersion;
    private MutableLiveData<String> errorData;


    public MutableLiveData<AppVersion> getAppVersion() {
        if (appVersion == null) {
            appVersion = new MutableLiveData<>();
        }
        return appVersion;
    }

    public MutableLiveData<String> getAppErrorData() {
        if (errorData == null) {
            errorData = new MutableLiveData<>();
        }
        return errorData;
    }

    public void GetLastVersionInfo() {
        AppUpdataManager.getInstance().GetLastVersionInfo(getShowDialog(), getAppVersion());
    }

    public void GetLastVersionAndErrorInfo() {
        AppUpdataManager.getInstance().changeRootApi();//更改baseUrl
        AppUpdataManager.getInstance().GetLastVersionInfo(getShowDialog(), getAppVersion(), getAppErrorData());
    }


}
